const Koa = require('koa')
const app = new Koa()
app.use(async (ctx, next) => {
  // console.log('1')
  await next()
  // console.log('2')
  const rt = ctx.response.get('X-Response-Time')
  console.log(`${ctx.method}${ctx.url}${rt}`)
})

app.use(async (ctx,next) => {
  const start = Date.now();
  console.log('3')
  await next()
  const ms = Date.now() - start
  ctx.set('X-Response-Time', `${ms}ms,it is run......`)
  // console.log('4','ms',ms)
})

app.use(async ctx => {
  console.log('hello')

  ctx.body = 'hello world3'
})
app.listen(3001)